package com.library.controller;


import com.library.common.base.ApiResult;
import com.library.common.entity.MyPage;
import com.library.entity.FeedBack;
import com.library.entity.ResourceEntity;
import com.library.entity.UserResource;
import com.library.entity.dto.FeedBackDto;
import com.library.entity.dto.UserResourceDto;
import com.library.service.ResourceAuditService;
import com.library.service.UserResourceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 用户浏览资源关联表 前端控制器
 * </p>
 *
 * @author ccl
 * @since 2025-02-19
 */
@RestController
@RequestMapping("/api/user-resource")
@Api(tags = "浏览记录", value = "浏览记录相关接口")
public class UserResourceController {

    @Resource
    private UserResourceService userResourceService;

    @ApiOperation(value = "分页查询")
    @PostMapping("/queryPage")
    public ApiResult<MyPage<ResourceEntity>> queryPage(@RequestBody UserResourceDto dto) {
        return ApiResult.ok(userResourceService.queryPage(dto));
    }

    @ApiOperation(value = "详情")
    @GetMapping("/{id}")
    public ApiResult getById(@PathVariable("id") Long id) {
        return ApiResult.ok(userResourceService.detail(id));
    }

    @ApiOperation(value = "新增")
    @PostMapping("/add")
    public ApiResult save(@RequestBody UserResource dto) {
        return ApiResult.ok(userResourceService.add(dto));
    }


}

